T1 P0
T0 P0

if !exists(param.H)
  M291 S5 J1 F250 L190 H450 R"Set Left Tool Temperature" P"Set temperature of the filament that was last loaded in the Left Tool"
  var ll = input
  G10 P0 R{var.ll} S{var.ll}



M98 P"homeall.g" L1 Z1 S1
M290 R0 S0

if move.axes[2].machinePosition < 20
  G91
  G1 Z20
  G90


T0
G90                 ; absolute positioning
G1 U{move.axes[3].max} F18000      ; Move second tool out of the way
G1 X{0 - sensors.probes[0].offsets[0]} Y{-150 - sensors.probes[0].offsets[1]} F18000
M558 K0 P5 C"duex.e6stop" H5 F300 T18000
M98 P"0:/user/ProbeOffset.g"
G30           ; Home bed using probe

M98 P"place.g"


T-1
T0

M83
G1 E-10 F{60}*{20}

M116 P0 S15
T-1
T0

G1 F18000 X0 Y-90 Z5

M208 Z-10 S1
M400
M291 S3 P"Press ""OK"" to save new Z offset" Z1


set global.zoffset = global.zoffset - move.axes[2].machinePosition - {0.08}  ; Apply babystepping to zoffset

echo >"0:/user/probeoffset.g" "; Set Z probe trigger value, offset and trigger height"
echo >>"0:/user/probeoffset.g" "G31 P500 X19.50 Y-23.00 Z"^{global.zoffset}


echo >"0:/user/zoffset.g" "if exists(global.zoffset)"
echo >>"0:/user/zoffset.g" "  set global.zoffset = "^{global.zoffset}
echo >>"0:/user/zoffset.g" "else"
echo >>"0:/user/zoffset.g" "  global zoffset = "^{global.zoffset}


M208 Z0 S1
G10 P0 R0 S0
G10 P1 R0 S0
G10 P2 R0 S0
G10 P3 R0 S0

G1 F18000 Z20 Y150 X{move.axes[0].min} U{move.axes[3].max}